﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using System.Diagnostics;

namespace Buccaneer
{
    public static class Options
    {
        #region Initialize

        public static void Initialize()
        {
            rescNames = new List<string>();
            rescContent = new List<object>();
        }

        #endregion

        #region Private attributes

        static Font font;
        static String layoutFolder;
        static String startupPlugin;
        static List<object> rescContent;
        static List<string> rescNames;

        #endregion

        #region Public attributes

        public static Font Font
        {
            get { return font; }
            set { font = value; }
        }

        public static String LayoutFolder
        {
            get { return "\\" + layoutFolder + "\\"; }
            set { layoutFolder = value; }
        }

        public static String StartupPluginName
        {
            get { return startupPlugin; }
            set { startupPlugin = value; }
        }

        #endregion

        #region Private Functions

        #endregion

        #region Public Functions

        public static void LoadImage(string name, string path)
        {
            rescNames.Add(name);
            rescContent.Add(Image.FromFile(path));
        }

        public static void AddResource(string name, object resc)
        {
            rescNames.Add(name);
            rescContent.Add(resc);
        }

        public static object GetResource(string name)
        {
            Debug.WriteLine("Loading resource: " + name);
            int index = rescNames.IndexOf(name);
            if (index == -1) Debug.WriteLine("(!) Action not found!");

            try
            {
                return rescContent[index];
            }
            catch (Exception)
            {
                Debug.WriteLine("(!) Something went wrong!");
            }
            return null;
        }

        #endregion
    }
}
